/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.games.epkb.entityClasses;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author plebani
 */
@Entity
@Table(name = "virtual_machine_conf")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "VirtualMachineConf.findAll", query = "SELECT v FROM VirtualMachineConf v"),
    @NamedQuery(name = "VirtualMachineConf.findById", query = "SELECT v FROM VirtualMachineConf v WHERE v.id = :id")})
public class VirtualMachineConf implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private String id;
    @Lob
    @Column(name = "Description")
    private String description;
    @ManyToMany(mappedBy = "virtualMachineConfCollection")
    private Collection<Service> serviceCollection;
    @OneToMany(mappedBy = "idVirtualMachineConf")
    private Collection<Annotation> annotationCollection;
    @OneToMany(mappedBy = "idVMConf")
    private Collection<VirtualMachineInst> virtualMachineInstCollection;

    public VirtualMachineConf() {
    }

    public VirtualMachineConf(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<Service> getServiceCollection() {
        return serviceCollection;
    }

    public void setServiceCollection(Collection<Service> serviceCollection) {
        this.serviceCollection = serviceCollection;
    }

    @XmlTransient
    public Collection<Annotation> getAnnotationCollection() {
        return annotationCollection;
    }

    public void setAnnotationCollection(Collection<Annotation> annotationCollection) {
        this.annotationCollection = annotationCollection;
    }

    @XmlTransient
    public Collection<VirtualMachineInst> getVirtualMachineInstCollection() {
        return virtualMachineInstCollection;
    }

    public void setVirtualMachineInstCollection(Collection<VirtualMachineInst> virtualMachineInstCollection) {
        this.virtualMachineInstCollection = virtualMachineInstCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VirtualMachineConf)) {
            return false;
        }
        VirtualMachineConf other = (VirtualMachineConf) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "it.polimi.games.epkb.entityClasses.VirtualMachineConf[ id=" + id + " ]";
    }
    
}
